#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QNetworkInterface>
#include <QDebug>
#include <QDialog>
#include <QDateTime>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    udp(new AWX_UDP)
{
    ui->setupUi(this);
    connect(udp,&AWX_UDP::toggle,this,&MainWindow::socket_toggled);
}

MainWindow::~MainWindow()
{
    delete udp;
    delete ui;
}

void MainWindow::on_action_udpcfg_triggered()
{
    udp->show();
}

void MainWindow::socket_toggled(bool vaild)
{
    if(vaild){
        ui->action_udpcfg->setIcon(QIcon(":/net_connect"));
    }else {
        ui->action_udpcfg->setIcon(QIcon(":/net_disconnect"));
    }
}

void MainWindow::on_pushButton_clicked()
{
    qDebug()<<QDateTime::currentDateTime();
}
